<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Mail extends CI_Controller {
	
	public function __construct()
		{
			parent::__construct();
			
			$this->load->helper('url');
		}
		
	function mail()
	{		
		//$myemail = 'whatsup@cloudwalkdigital.com';//<-----Put Your email address here.
		$myemail = 'hbg_009@ymail.com';//<-----Put Your email address here.

		$name = $_POST['name']; 
		$subject = $_POST['subject'];
		$email_address = $_POST['email']; 
		$message = $_POST['message']; 

		$to = $myemail; 
		$email_subject = "$subject";
		$email_body = "$message"; 
		
		$headers = "From: $myemail\n"; 
		$headers .= "Reply-To: $email_address";
		
		
		//redirect to the 'thank you' page
		if(mail($to,$email_subject,$email_body,$headers)){
			echo "mail successful send";
		}else{ 
			echo "there's some errors to send the mail, verify your server options";
		}
		//echo 'test';
	}

}
